package com.mice.controller
{
	import com.iyimo.core.mvc.Controller;
	import com.iyimo.event.Notification;
	import com.iyimo.manager.SpriteManager;
	import com.iyimo.scene.SceneSwitcher;
	import com.mice.command.bean.UserBean;
	import com.mice.constant.NotifyConst;
	import com.mice.event.GameEvent;
	import com.mice.view.select.SelectLevelScene;
	
	import flash.events.Event;

	/**
	 * 关卡选择控制器
	 */	
	public class LevelController extends Controller{
		public static const NAME:String = "LevelController";
		
		/**
		 * 选关
		 */		
		private var _scene:SelectLevelScene;
		
		public function LevelController(){}
		
		override public function onRegister():void{
			_scene = new SelectLevelScene(SpriteManager.getSprite("gameMap"));
			_scene.addEventListener(GameEvent.START_GAME, onStartGame);
			
			listenNotification(NotifyConst.NOTIFY_START_STORY, startStory);
		}
		
		/**
		 * 响应view点击事件
		 */		
		private function onStartGame(e:GameEvent):void{
			sendNotification(NotifyConst.NOTIFY_PLAY_GAME);
		}
		
		private function startStory(e:Notification):void{
			SceneSwitcher.action(_scene, null);
		}
	}
}